<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateWxusersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('wxusers', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('mall_id')->comment('租户ID');
            $table->string('wx_openid')->unique()->comment('微信opendid');
            $table->string('wx_unionid')->default('')->comment('微信UnionID');
            $table->string('wx_nickname')->default('')->index()->comment('微信用户昵称');
            $table->string('wx_headimgurl')->default('')->comment('微信头像');
            $table->tinyInteger('wx_sex')->default(0)->comment('用户的性别');
            $table->string('wx_province')->default('')->comment('用户的性别');
            $table->string('wx_city')->default('')->comment('用户的性别');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('wxusers');
    }
}
